package it.multisystem.gettingstarted.geometry;

public class Line {
	private final double m;
	private final double q;
	
	public Line(Point p1, Point p2) {
		double dx = p1.getX() - p2.getX();
		double dy = p1.getY() - p2.getY();
		m = dy / dx;
		q = p1.getY() - m * p1.getX();
	}

	public boolean contains(Point aPoint) {
		return Math.abs(aPoint.getY() - q - m * aPoint.getX()) < 0.00001;
	}

}
